package com.taxshare.api.controller;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.taxshare.api.service.SellerInvoiceService;
import com.taxshare.api.view.dto.InterfaceDTO;
import com.taxshare.api.view.dto.SellerInvoiceDTO;
import com.taxshare.api.view.dto.WriteBackInvoiceDTO;
import com.taxshare.response.beans.Response;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author liupp
 * @ClassName: SellerInvoiceController
 * @Description: (销项)
 * @date 2021年4月14日
 */
@RestController
@RequestMapping("/seller")
public class SellerInvoiceController {

    @Autowired
    SellerInvoiceService sellerInvoiceService;

    @PostMapping("/callSST")
    @ApiOperation(value = "请求税神通", notes = "销项Api")
    public Response callSST(@RequestBody SellerInvoiceDTO sellerInvoiceVo) {
        return sellerInvoiceService.callSST(sellerInvoiceVo);
    }

    @PostMapping("/callSales")
    @ApiOperation(value = "请求销项接口", notes = "销项Api")
    public Response callSales(@RequestBody InterfaceDTO interfaceDTO) throws Exception {
        return sellerInvoiceService.callSales(interfaceDTO);
    }

    @PostMapping("/autoHead")
    @ApiOperation(value = "进项发票识别", notes = "销项Api")
    public Response autoHead(@RequestBody SellerInvoiceDTO sellerInvoiceDTO) {
        return sellerInvoiceService.autoHead(sellerInvoiceDTO);
    }

    @PostMapping("/writeBackIncoice")
    @ApiOperation(value = "回传开具信息给明源", notes = "销项Api")
    public Response writeBackIncoice(@RequestBody WriteBackInvoiceDTO writeBackInvoiceDTO) {
        return sellerInvoiceService.writeBackIncoice(writeBackInvoiceDTO);
    }

    @PostMapping("/syncProjectInfo")
    @ApiOperation(value = "同步明源项目信息", notes = "销项Api")
    public Response syncProjectInfo() {
        return sellerInvoiceService.syncProjectInfo();
    }
}
